<?php
$sql_btn = "SELECT * FROM paginabotao ORDER BY pag_btn_nome";
$res_btn = sql($sql_btn);
while($linha_btn = mysql_fetch_array($res_btn)) {
?>
<p><input name="pag_btn_id[]" type="checkbox" value="<?=$linha_btn['pag_btn_id'];?>" <?php if (count($pag_btn_id) >0) { if (in_array($linha_btn['pag_btn_id'],$pag_btn_id)) { echo "checked"; } } ?>/> <?php echo $linha_btn['pag_btn_botao'];?></p>
<? } ?>